package routers

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"xwWechatPublic/services"
)

// InitRouter initialize routing information
func InitRouter() *gin.Engine {
	r := gin.New()
	r.Use(gin.Logger())
	r.Use(gin.Recovery())

	// Ping test
	r.GET("/ping", func(c *gin.Context) {
		c.String(http.StatusOK, "pong")
	})

	////获取token
	//r.POST("/auth", services.PostAuth )
	//
	//
	//apiv1 := r.Group("/api/dm")
	//apiv1.Use(middleware.JWT())
	//{
	//	//获取标签列表
	//	apiv1.POST("/list",  services.PostDramaList )
	//}

	//配置验证 https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
	r.GET("/wx/public/recv_msg", services.GetCheckServer)
	//r.POST("/wx/public/recv_msg", services.GetCheckServer)

	//接收文本消息
	r.POST("/wx/public/recv_msg", services.PostRecvMsgHand)
	//r.PATCH()

	return r
}
